<?php



// 在这段代码中，我们将实现信息的读取



// file函数能将整个函数读取到数组中

// 此外php提供了逐个字符、逐行读取文件的函数



$data = file('file.csv');



// $r = explode(',',$data[0]);



foreach ($data as $key => $value) {

    // echo $key . "<br>";

    $data[$key] = explode(',',$value);

}

// var_dump($data);



// echo "<pre>";

// print_r($data);

// print_r($r);

// echo "</pre>";

?>

<!DOCTYPE html>

<html lang="zh-CN">



<head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->

    <title>学员信息收集表单</title>

    <!-- Bootstrap -->

    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->

    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->

    <!--[if lt IE 9]>

      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>

      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>

    <![endif]-->

    <style type="text/css">

    .studentinfo {

        margin-top: 50px;

    }

    </style>

</head>



<body>

    <div class="container">

        <div class="row">

            <div class="col-md-8 col-md-offset-2">

                <div class="panel panel-default studentinfo">

                    <div class="panel-heading">

                        <h3 class="panel-title">学员信息</h3>

                    </div>

                    <div class="panel-body">

                        <table class="table table-bordered table-hover">

                        <tr><td>序号</td><td>姓名</td><td>学号</td><td>仓库地址</td></tr>

                        <?php foreach ($data as $key => $value): ?>

                            <tr><td><?php echo $key ?></td><td><?php echo $value[0] ?></td><td><?php echo $value[1] ?></td><td><a target="_blank" href="<?php echo $value[2] ?>"><?php echo $value[2] ?></a></td></tr>

                        <?php endforeach; ?>

                        </table>

                    </div>

                </div>

            </div>

        </div>

    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>

    <!-- Include all compiled plugins (below), or include individual files as needed -->

    <script src="bootstrap/js/bootstrap.min.js"></script>

</body>



</html>

